<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8"/>
    <title>Insert title here</title>
</head>
<body>
<h1>欢迎登录</h1>
<h1 th:if="${msg != null }" th:text="${msg}" style="color: red"></h1>
<form action="/login" method="post">
    用户名：<input type="text" name="username"/><br/>
    密码：<input type="password" name="password"/><br/>


    验证码：<input type="text" name="kaptchaCode"/>
    <img alt="验证码" th:src="@{/kaptcha}" title="点击更换" id="getKaptcha"/>
    (看不清<a href="javascript:void(0)" onclick="javascript:refreshCaptcha()">换一张</a>)<br/>

    <br/>
    <input type="checkbox" name="rememberMe"/>记住我<br/>
    <input type="submit" value="提交"/>
    <a href="/unlockAccount">解锁admin用户</a></button>
</form>
</body>
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
<script type="text/javascript">
    function kickout() {
        var href = location.href;
        if (href.indexOf("kickout") > 0) {
            alert("您的账号在另一台设备上登录,如非本人操作，请立即修改密码！");
        }
    }

    window.οnlοad = kickout();
    function refreshCaptcha(){
        $("#getKaptcha").attr("src","/kaptcha?id=" + new Date() + Math.floor(Math.random()*24));
    }
</script>
</html>